class CreateComputers < ActiveRecord::Migration
  def self.up
    create_table :computers do |t|
      t.string :title, :limit => 64, :null => false
      t.string :cpu, :limit => 64, :null => false
      t.string :ram, :limit => 64, :null => false
      t.string :motherboard, :limit => 64, :null => false
      t.string :vga, :limit => 64, :null => false
      t.string :hd, :limit => 64, :null => false
      t.string :cd, :limit => 64, :null => false
      t.string :audio, :limit => 64, :null => false
      t.string :power, :limit => 64, :null => false
      t.text :description, :limit => 512
      
      t.integer :cpu_price, :default => 0
      t.integer :ram_price, :default => 0
      t.integer :motherboard_price, :default => 0
      t.integer :vga_price, :default => 0
      t.integer :hd_price, :default => 0
      t.integer :cd_price, :default => 0
      t.integer :audio_price, :default => 0
      t.integer :power_price, :default => 0
      t.integer :total_price, :default => 0
      
      t.integer :popular, :default => 1
      
      t.string :user_name, :limit => 32, :null => false
      t.string :user_link, :limit => 64
      t.timestamps
    end
  end

  def self.down
    drop_table :computers
  end
end
